﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading;

namespace BL
{

    //public class cEnemyCommanderManager
    //{
    //    //cTCPConnectionHandler m_ConectionHandler;
    //    //public cTCPConnectionHandler ConnectionHandler
    //    //{
    //    //    get { return m_ConectionHandler; }
    //    //    set { m_ConectionHandler = value; }
    //    //}

    //    public cTeam ExchangeTeams(cTeam myTeam, bool isServer, int port, string IP)
    //    {
    //        byte[] data;
    //        MemoryStream stream = new MemoryStream();
    //        ConnectionHandler = new cTCPConnectionHandler();
    //        BinaryFormatter serializer = new BinaryFormatter();
    //        serializer.Serialize(stream, myTeam);
    //        if (isServer)
    //        {
    //            ConnectionHandler.StartListening(port);
    //        }
    //        else
    //        {
    //            if (!ConnectionHandler.Connect(IP, port))
    //            {
    //                return null;
    //            }
    //        }
    //        ConnectionHandler.SendData(stream.ToArray());
    //        do
    //        {
    //            Thread.Sleep(1000);
    //            data = ConnectionHandler.ReceiveData();
    //        } while (data == null);
    //        stream = new MemoryStream();
    //        stream.Write(data, 0, data.Count());
    //        stream.Position = 0;
    //        return (cTeam)serializer.Deserialize(stream);
    //    }
    //}
}
